package com.example.juc.until;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;

public class jianfaCountDownLatch {
    public static void main(String[] args) throws InterruptedException {

        CountDownLatch countDownLatch =new CountDownLatch(6);
        for (int i = 1; i <=6 ; i++) {
            new Thread(()->{
                System.out.println(Thread.currentThread().getName()+"go out");
                countDownLatch.countDown(); //-1;
            },i+"").start();
        }
        countDownLatch.await();//等待计数器归零然后，向下执行
    }
}
